<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
		<link rel="stylesheet" type="text/css" href="../css/aui.css"/>
		<link rel="stylesheet" type="text/css" href="../icon/aosen/css/font-awesome.min.css" />
    <style>
    	body,html{
				background:#f2f2f2;
    	}
      .my-list{
          width: 100%;
          height: 6rem;
          background: white;
          margin-top: 0.4rem;
      }
      .product-image,.product-msg{
          height: 100%;
          display:flex;
    			display:-webkit-flex;
    			flex-direction: column;
    			-webkit-justify-content: center;
      		justify-content: center;
      }
      .img-box{
          width: 92%;
          height:5rem;
          margin: 0 auto;
          overflow: hidden;
      }
      .img-box img{
          width: 100%;
          height: 100%;
          display: block;
      }
      .msg-box{
          width: 100%;
          height:5rem;
      }
      .titleAname{
          width: 100%;
          height: 2rem;
          padding-right: 0.5rem;
          font-size: 4vw;
          line-height: 1rem
      }
      .price{
          width: 100%;
          height: 1.5rem;
          padding-right: 0.5rem;
          color: #ff4800;
          font-weight: bold;
          line-height: 1.5rem;
      }
      .version{
          width: 100%;
          height: 1.5rem;
          text-align: right;
          color: gray;
          padding-right: 0.5rem;
          line-height: 1.5rem
      }
    </style>
</head>
<body>
    <!--<div class="my-list aui-row" >
        <div class="aui-col-xs-5 product-image">
            <div class="img-box">
                <img src="../image/box.png">
            </div>
        </div>
        <div class="aui-col-xs-7 product-msg">
            <div class="msg-box">
                <div class="titleAname aui-ellipsis-2">哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇</div>
                <div class="price">&yen;450</div>
                <div class="version">安卓版</div>
            </div>
        </div>
    </div>-->
    <div class="aui-hide" id="noData" style="text-align: center">
    	<img src="../image/nodata.jpg"/>
    	<span>暂无数据~~</span>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/request.js"></script>
<script type="text/javascript">
	var gameId;
	var userType;
	apiready = function(){
		api.setRefreshHeaderInfo({
		    loadingImg: 'widget://image/refresh.png',
		    bgColor: 'rgba(0,0,0,0)',
		    textColor: 'rgb(150,150,150)',
		    textDown: '下拉刷新...',
		    textUp: '松开刷新...'
		}, function(ret, err) {
		    getGoodsList('YES','YES');

		});
		gameId = api.pageParam.data.id;
		userType = api.pageParam.data.userType;
		getGoodsList('NO','NO');
	};
  function goToProductDetail(id){
      api.openWin({
          name: 'ProductDetailPage',
          url: './winProDetail.html',
          pageParam: {
              page:'ProductDetailPage',
              title: '商品详情',
              data:{
              	id:id
              }
          }
      });
  }
  function getGoodsList(loading,isdown){
  	var data = {};
  	data['values'] = {};
  	data['values']['gameId'] = gameId;
  	data['values']['userType'] = userType;
  	requestData('Goods/getGoodsList',data,loading,'NO',isdown,_callbackGoodsList);
  }
  function _callbackGoodsList(ret){
  	if(ret.status == 200){
  		if(ret.list.length>0){
  			$api.addCls($api.byId('noData'), 'aui-hide');
  			$api.css($api.dom('html'),'background:#f2f2f2');
  			$api.css($api.dom('body'),'background:#f2f2f2');
  			var html = '';
  			for(var i=0;i<ret.list.length;i++){
  				var images = ret.list[i].goods_img;
  				html+='<div class="my-list aui-row" onclick="goToProductDetail('+ret.list[i].id+')">';
  				html+='<div class="aui-col-xs-5 product-image">';
  				html+='<div class="img-box">';
  				html+='<img src="'+pictureUrl+images.split(',')[0]+'">';
  				html+='</div>';
  				html+='</div>';
  				html+='<div class="aui-col-xs-7 product-msg">';
  				html+='<div class="msg-box">';
  				html+='<div class="titleAname aui-ellipsis-2">'+ret.list[i].game_name+'【'+ret.list[i].server+'】'+ret.list[i].goods_word+'</div>';
  				html+='<div class="price">&yen;'+ret.list[i].goods_price+'</div>';
  				html+='<div class="version">'+ret.list[i].platform+'</div>';
  				html+='</div>';
  				html+='</div>';
  				html+='</div>';
  			}
  			$api.html($api.dom('body'), html);
  		}else{
  			$api.removeCls($api.byId('noData'), 'aui-hide');
  			$api.css($api.dom('html'),'background:white');
  			$api.css($api.dom('body'),'background:white');
  		}
  	}
  }
</script>
</html>
